﻿using FarmSmartSleep.Common.Domain.Sales_Purchase;
using FarmSmartSleep.Common.Dtos;
using FarmSmartSleep.Organ.API.Application.Sales_Purchase.BreedingSales;
using FarmSmartSleep.Organ.API.Application.Sales_Purchase.PersonalProcurement;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace FarmSmartSleep.Organ.API.Controllers
{
    /// <summary>
    /// 采购管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class Sales_PurchasesController : ControllerBase
    {

        private readonly IMediator mediator;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="mediator"></param>
        public Sales_PurchasesController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        #region 采购
        /// <summary>
        /// 采购添加
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> PersonalProcurementCreate (PersonalProcurementCreateCommon result)
        {
            return await mediator.Send(result);
        }
        /// <summary>
        /// 采购列表
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ResultPage<List<Proc>>> PersonalProcurementList ([FromQuery]PersonalProcurementListCommon result)
        {
            return await mediator.Send(result);
        }


        #endregion

        #region 销售
        /// <summary>
        /// 销售添加
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> BreedingSalesCreate (BreedingSalesCreateCommon result)
        {
            return await mediator.Send(result);
        }
        /// <summary>
        /// 销售列表
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ResultPage<List<SalesRecordListDto>>> BreedingSalesList([FromQuery] BreedingSalesListCommon result)
        {
            return await mediator.Send(result);
        }
        #endregion


    }
}
